package com.feature.learn.concurrent.Semaphore.sampe1;

/**
 *
 * @author 01390942
 * @Description
 * @create 2021/7/5
 * @since 1.0.0
 */
public class Semaphore3Test {
    public static void main(String[] args) {
        Semaphore3Service service3 = new Semaphore3Service(6);


        for (int i = 0; i < 10; i++) {
            /**
             * 初始化放在此，lock不生效，因为使用的不是同一个 SemaphoreService 对象实例，所有是多个锁分别加在了多个 SemaphoreService 实例中，就相当于没有锁
             */
//            Semaphore3Service service3 = new Semaphore3Service(6);

            Service3Thread service3Thread = new Service3Thread("service2Thread" + i, service3);
            service3Thread.start();
            service3.printInfo();
        }
    }
}